package com.lap.starter.application;

import com.lap.framework.dto.result.Result;
import com.lap.framework.enums.SystemCode;
import com.lap.framework.exception.RemoteCallException;
import com.lap.starter.adapter.driving.ApiClient;
import com.lap.starter.application.dto.ApiClientDto;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@RequiredArgsConstructor
@Service
public class ApiClientAppService {

  @Resource private ApiClient apiClient;

  public void createApi(ApiClientDto dto) {
    Result<Void> result = apiClient.createApi(dto);
    if (SystemCode.failure(result.getCode())) {
      throw new RemoteCallException(result.getCode(), result.getMessage());
    }
  }
}
